package com.lsk.util;

import com.jfinal.plugin.activerecord.Record;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/1/20 0020.
 */
public class MapToRecord {
    public static List<Record> getListRecord(List<Map<String,Object>> listMap){
        List<Record> recordList=new ArrayList<>();
        for (int i=0;i<listMap.size();i++){
           Map<String, Object> tempMap=listMap.get(i);
           Record record=new Record();
           for (Map.Entry entry : tempMap.entrySet()) {
               record.set(entry.getKey()+"",entry.getValue());
           }
            recordList.add(record);
        }
        return recordList;
    }

    public static Record getRecord(Map<String,String[]> map){
        Record record=new Record();
        for (Map.Entry<String,String[]> entry : map.entrySet()) {
            record.set(entry.getKey()+"",entry.getValue()[0]);
        }
        return record;
    }
}
